<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/calendar/zh_CN/jquery-ui.min.js"></script>
<script language="javascript">
	$(function(){
		$("#done").hide();
		$("#doing").hide();
		$("#fail").hide();
	});
	
	function beforeStart(){
		$("#doing").show();
		$("#startButton").attr("disabled","true");
		$.ajax({
			url : "EquipHealthStateAction!startJob",
			//data : $("#formArea").serialize(),
			type : "get",
			error : function() {
				alert("设备健康状态统计回调返回失败！");
			},
			success : function(data) {
				if(data == "success"){
					$("#doing").hide();
					alert("统计完成！");
					$("#done").show();
				}else{
					$("#doing").hide();
					alert("统计完成！");
					$("#fail").show();
				}
			}
		});
	}
	
</script>
<title>设备健康状态</title>
<style type="text/css">
	#info{
		margin-left:40%;
		margin-top:50px;
	}
	
	#startButton{
		margin-top:10px;
		margin-left:40%;
	}
	
	#resultDiv{
		margin-left:40%;
	}
</style>
</head>
<body>
	<div id="info">
		上次统计总数：<%=request.getAttribute("count") %>
	</div>
	<button onclick="beforeStart();" id="startButton">设备健康状态统计</button>
	<input type="button"  value="返回" id="subID" onclick="javascript:window.history.go(-1)"/>
	
	<div id="resultDiv">
		<span id="doing">正在统计中...</span>
		<span id="done" >统计完成！</span>
		<span id="fail">统计失败</span>
	</div>
</body>
</html>